package com.group.hugedatabehind.mapper;

import com.group.hugedatabehind.pojo.User;
import org.apache.ibatis.annotations.*;

import java.util.List;


@Mapper
public interface LoginMapper {
//    @Select("select * from db_user")
//    @Results({
//            @Result(column = "db_user.username", property = "username"),
//            @Result(column = "db_user.password", property = "password")
//    })
//    List<User> getUser();

    @Select("select * from db_user where username=#{username}")
    @Results({
            @Result(column = "db_user.username", property = "username"),
    })
    User getUsername(String username);

    @Insert("insert into db_user(username, password) values(#{username},#{password})")
    void userInsert(User user);

    @Select("select * from db_user where username=#{username} and password=#{password}")
    @Results({
            @Result(column = "db_user.username", property = "username"),
            @Result(column = "db_user.password", property = "password")
    })
    User getOneUser(User user);


}
